********* Table A16 *********
clear all
set more off 
capture log close
 
* main path to data
global path "~/Dropbox/Paraguay/1_data/7_replication_dataverse"
capture cd "$path"	

*tables = analysis tables
global tables "$path/tables"


* Load panel data
use "$path/data/repression_panel.dta", clear

* Create period dummies (using underscores instead of hyphens)
foreach period in 1954_1958 1959_1963 1964_1968 1969_1973 1974_1978 1979_1983 1984_1988 {
    gen period_`period' = 0
}

replace period_1954_1958 = 1 if year < 1959
replace period_1959_1963 = 1 if year >= 1959 & year < 1964
replace period_1964_1968 = 1 if year >= 1964 & year < 1969
replace period_1969_1973 = 1 if year >= 1969 & year < 1974
replace period_1974_1978 = 1 if year >= 1974 & year < 1979
replace period_1979_1983 = 1 if year >= 1979 & year < 1984
replace period_1984_1988 = 1 if year >= 1984 & year <= 1988

* Generate alt_base and set to 0 
gen alt_1954_1958 = 0


reghdfe log_violations ///
     alt_1954_1958  period_1959_1963#c.degree_z period_1964_1968#c.degree_z ///
    period_1969_1973#c.degree_z period_1974_1978#c.degree_z period_1979_1983#c.degree_z ///
    period_1984_1988#c.degree_z degree_z  ///
    if year > 1954 & year <= 1988, absorb(year#depa) cluster(district) nocons
	
	
	eststo

capture cd "$tables"
esttab est* using "tableA16.tex", replace nonumber label style(tex) ///
		cells(b(star fmt(%12.4fc)) se(par fmt(%12.4fc))) ///
		stats( N r2 , fmt( %12.0fc %12.4fc ) ///
			label("\hline Observations"  ///
			  "\$R^2\$" )) ///
		keep(1.period_1959_1963#c.degree_z 1.period_1964_1968#c.degree_z 1.period_1969_1973#c.degree_z ///
		1.period_1974_1978#c.degree_z 1.period_1979_1983#c.degree_z  1.period_1984_1988#c.degree_z) ///	
		order(1.period_1959_1963#c.degree_z 1.period_1964_1968#c.degree_z 1.period_1969_1973#c.degree_z ///
		1.period_1974_1978#c.degree_z 1.period_1979_1983#c.degree_z  1.period_1984_1988#c.degree_z) ///
		varlabels(1.period_1959_1963#c.degree_z "1959-1963 \$\times\$ Avg. Degree"  1.period_1964_1968#c.degree_z "1964-1968 \$\times\$ Avg. Degree" ///
		1.period_1969_1973#c.degree_z "1969-1972 \$\times\$ Avg. Degree" ///
		1.period_1974_1978#c.degree_z "1974-1978 \$\times\$ Avg. Degree" 1.period_1979_1983#c.degree_z "1979-1983 \$\times\$ Avg. Degree" ///
		1.period_1984_1988#c.degree_z "1984-1988 \$\times\$ Avg. Degree") ///
		collabels(, none) eqlabels(, none) starlevels(* 0.1 ** 0.05 *** 0.01) ///
		prehead(\begin{tabular}{l*{@M}{c}} \hline ///
			&  \multicolumn{1}{c}{Colorado Party Affiliations (log)}   \\ ///
			& (1)    \\)  ///
		posthead(\hline ) mlabels(, none) ///
		prefoot( ) postfoot(\hline \end{tabular})
	
